﻿Imports WindowsApplication1.saktiewebservice

Public Class ProductToevoegen
    Private Klant As New Klant
    Private webser As New Service1SoapClient
    Public Property klant_form() As Klant
        Get
            Return Klant
        End Get
        Set(ByVal value As Klant)
            Klant = value
        End Set
    End Property
    Private Sub ProductToevoegen_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.MaximumSize = Me.Size
        Me.MinimumSize = Me.Size
    End Sub

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        klant_form.Show()
        Me.Close()
    End Sub

    Private Sub btnToevoegen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnToevoegen.Click
        If webser.insertProduct(txtNaam.Text, Decimal.Parse(txtPrijs.Text), txtOmschrijving.Text) Then
            MsgBox("Product toegevoegd.")
            dgProducten.DataSource = webser.getAlleProducten()
            dgProducten.Update()
            txtNaam.Text = ""
            txtOmschrijving.Text = ""
            txtPrijs.Text = ""
        Else
            MsgBox("Er ging iets fout.")
        End If
    End Sub
End Class